
"""
解决classTest02传参问题：
    classTest02中，Son_1和Son_2的参数需要根据Grand_son的参数变化，不能写死

    使用*args和**kwargs，*args是可变的位置参数列表，**kwargs是可变的关键字参数列表
"""


class Father(object):
    def __init__(self, name, *args, **kwargs):
        self.name = name
        print("I'm Father")


class Son1(Father):
    def __init__(self, name, age, *args, **kwargs):
        print("I'm Son_1")
        super(Son1, self).__init__(name, *args, **kwargs)
        self.age = age


class Son2(Father):
    def __init__(self, name, gender, *args, **kwargs):
        print("I'm Son_2")
        super(Son2, self).__init__(name, *args, **kwargs)
        self.gender = gender


class GrandSon(Son1, Son2):
    def __init__(self, name, age, gender):
        super(GrandSon, self).__init__(name, age, gender)


grand_son = GrandSon("王五", 18, "男")


